package com.oa.ylms.apps.actions.organization;

import java.util.List;

import com.oa.ylms.apps.actions.BasicAction;
import com.oa.ylms.apps.business.organization.ISectionCategoryService;
import com.oa.ylms.apps.entity.organization.SectionCategoryValue;

@SuppressWarnings("serial")
public class SectionCategoryAction extends BasicAction {
	private List<SectionCategoryValue> list;
	private ISectionCategoryService categoryService;
	
	private Integer categoryId;
	private String categoryIds;
	private String categoryName;
	
	public List<SectionCategoryValue> getList() {
		return list;
	}
	public void setList(List<SectionCategoryValue> list) {
		this.list = list;
	}
	public ISectionCategoryService getCategoryService() {
		return categoryService;
	}
	public void setCategoryService(ISectionCategoryService categoryService) {
		this.categoryService = categoryService;
	}
	public Integer getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}
	public String getCategoryIds() {
		return categoryIds;
	}
	public void setCategoryIds(String categoryIds) {
		this.categoryIds = categoryIds;
	}
	public String getCategoryName() {
		return categoryName;
	}
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	
	public String execute() throws Exception {
		list = categoryService.queryALLCategoryInfo();
		count = list.size();
		return "show";
	}
	
	public String add() throws Exception {
		if(categoryService.addSectionCategory(categoryName) != 0){
			return "add";
		}
		return "false";
	}
	
	public String modify() throws Exception{
		if(categoryService.modifySectionCategory(categoryId, categoryName))
		{
			return "modify";
		}
		return "false";
	}
	
	public String delete() throws Exception{
		if(categoryService.deleteSectionCategory(categoryIds)){
			return "delete";
		}
		return "false";
	}
	
	public String toDisable() throws Exception{
		if(categoryService.toDisable(categoryId)){
			return "toDisable";
		}
		return "false";
	}
	
	public String toEnable() throws Exception{
		if(categoryService.toEnable(categoryId)){
			return "toEnable";
		}
		return "false";
	}
	
	public String sort() throws Exception{
		return "sort";
	}
}
